<?php

// The user is redirected here from login.php.

session_start(); // Start the session.

// If no cookie is present, redirect the user:
// Also validate the HTTP_USER_AGENT!
if (!isset($_SESSION['agent']) or ($_SESSION['agent'] != md5($_SERVER['HTTP_USER_AGENT']))) {
	
	// Need the function to create an absolute URL:
	require_once 'includes/login_function.inc.php';
	$url = absolute_url();
	header("Location: $url");
	exit(); // Quit the script.
	
}

// Set the page title and include the HTML header:
$page_title = 'Logged In!';
include 'includes/header.html';

// Print a customized message:
echo "<h1>Logged In!</h1>
		<p>You are now logged in, {$_SESSION['first_name']}!</p>
		<p><a href=\"logout.php\">Logout</a></p>";

include 'includes/footer.html';

?>